/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('osssddp', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model GetSddpVersionRequest {
  clientToken?: string(name='ClientToken'),
}

model GetSddpVersionResponseBody = {
  content?: int32(name='Content'),
  requestId?: string(name='RequestId'),
}

model GetSddpVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSddpVersionResponseBody(name='body'),
}

/**
 * @summary 查看用户的敏感数据保护版本信息
 *
 * @param request GetSddpVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSddpVersionResponse
 */
async function getSddpVersionWithOptions(request: GetSddpVersionRequest, runtime: Util.RuntimeOptions): GetSddpVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSddpVersion',
    version = '2024-02-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查看用户的敏感数据保护版本信息
 *
 * @param request GetSddpVersionRequest
 * @return GetSddpVersionResponse
 */
async function getSddpVersion(request: GetSddpVersionRequest): GetSddpVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSddpVersionWithOptions(request, runtime);
}

model UpgradeSddpVersionRequest {
  clientToken?: string(name='ClientToken'),
  ossVersion?: int32(name='OssVersion'),
}

model UpgradeSddpVersionResponseBody = {
  content?: string(name='Content'),
  requestId?: string(name='RequestId'),
}

model UpgradeSddpVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeSddpVersionResponseBody(name='body'),
}

/**
 * @summary 升级敏感数据保护版本
 *
 * @param request UpgradeSddpVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeSddpVersionResponse
 */
async function upgradeSddpVersionWithOptions(request: UpgradeSddpVersionRequest, runtime: Util.RuntimeOptions): UpgradeSddpVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.ossVersion)) {
    query['OssVersion'] = request.ossVersion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeSddpVersion',
    version = '2024-02-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 升级敏感数据保护版本
 *
 * @param request UpgradeSddpVersionRequest
 * @return UpgradeSddpVersionResponse
 */
async function upgradeSddpVersion(request: UpgradeSddpVersionRequest): UpgradeSddpVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradeSddpVersionWithOptions(request, runtime);
}

